<?php

namespace App\Trip\Notify\Sms\Messages\Train;

use App\Models\Train\TrainOrders\TrainOrder;
use Illuminate\Support\Str;
use Overtrue\EasySms\Contracts\GatewayInterface;
use Overtrue\EasySms\Message;

class SnapConfirmNotifyMessage extends Message
{
    //kepter 出票成功
    private TrainOrder $order;

    public function __construct(TrainOrder $order)
    {
        $this->order = $order;
    }

    // 定义直接使用内容发送平台的内容
    public function getContent(GatewayInterface $gateway = null)
    {
        return '';
    }

    // 定义使用模板发送方式平台所需要的模板 ID
    public function getTemplate(GatewayInterface $gateway = null)
    {
        return '1571689';
    }

    // 模板参数
    public function getData(GatewayInterface $gateway = null)
    {
        $train = $this->order->getMainTrain();
        return [
            1 => Str::limit(" {$train->getFromNameUy()}->{$train->getToNameUy()} ", 80, ""),
        ];
    }
}